Checking for attributes in passed object

Is there a way to check if an object that's been passed to a function has a particular attribute?  I'm having an issue with certain attributes that are in one baseline, but not in another one that I'm comparing the object with.  For example, I have 2 baselines, one of which has attributeABC defined, but that attribute does not exist in the other baseline.  I am sending an object from one of the baselines to a function.  I want to figure out if that specific object contains a particular attribute (i.e. attributeABC).  I thought that I could just use the exists function on the object to check for the existence of this attribute, but according to the manual, the exists function only works on a module level.

 

Chris


chrscote - Wed Apr 26 12:23:25 EDT 2017

Re: Checking for attributes in passed object
PekkaMakinen - Wed Apr 26 13:45:58 EDT 2017

Well, actually attributes are created and defined for a module. An attribute might be a module attribute or an object attribute, meaning it might have a value for the module or it might have value for all objects in that module.

So actually you want to check if the baseline  to be compared loaded as a module contains the named attribute (and maybe if that is of the same type than in the other baseline / current module). Check the versionCompare.inc attachment in https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014628773

I tried to find a good description of the DOORS module-object-attribute hierarchy (structure?), but e,g, IBM itself writes this kind of c**p in the DOORS Help "Formal modules contain objects that are defined by their attributes."  Sorry, no help.

Re: Checking for attributes in passed object
EHcnck - Wed Apr 26 15:00:35 EDT 2017

"but according to the manual, the exists function only works on a module level." Not seeing this limitation in the manual

 

bool exists(attribute(string attributeName))
Operation
Returns true if the attribute named attributeName exists in the current module.
Example
if (exists attribute "Cost")
print "Cost is already there.\n"